package data_structure

object TestArray {
  def main(args: Array[String]): Unit = {
    val intValueArr = new Array[Int](3)
    println("初始化之后的默认值：")
    for (i <- intValueArr) {
      println(i)
    }
    println("对数组元素重新赋值：")
    intValueArr(0) = 5
    intValueArr(1) = 10
    intValueArr(2) = 90
    for (i <- intValueArr) {
      println(i)
    }

    val myStrArr = new Array[String](3)
    myStrArr(0) = "BigData"
    myStrArr(1) = "Hadoop"
    myStrArr(2) = "Spark"
    for (i <- myStrArr) {
      println(i)
    }

    val myStrArr2 = Array("Hello", "World", "Nice")
    for (i <- myStrArr2) {
      println(i)
    }

    val myMatrix = Array.ofDim[Int](3,4)
    println(s"myMatrix(1)(2): ${myMatrix(1)(2)}")
    val myCube = Array.ofDim[Int](3,2,4)
    println(s"myCube(1)(1)(3): ${myCube(1)(1)(3)}")
  }
}
